<template>
  <div>
    <input ref="inp" type="text">
    <button @click="fn">点击获取焦点</button>
    <TestCom ref="testComRef"></TestCom>
    <button @click="testCom">获取子组件</button>
  </div>
</template>

<style lang="less">

</style>
<script setup>
import {onMounted, ref} from "vue";
import TestCom from "@/components/Test-com.vue";
const inp = ref(null)
const fn = ()=>{
  inp.value.focus()
}

const testComRef = ref(null)
const testCom = ()=>{
  console.log(testComRef.value.count)
  testComRef.value.sayHi()
}
</script>
